package com.jackstraw.jack_base.datasource.database.generator.entity;


import com.jackstraw.jack_base.util.StringUtil;
import com.jackstraw.jack_base.util.entity.enums.DataBaseEnum;
import lombok.Data;

import java.util.List;

/**
 * 生成类型
 */
@Data
public class GeneratorVo {

    /**
     * 生成数据库的实体
     */
    private String dataSourceName;

    /**
     * 需要生成的表名称
     */
    private List<String> tableNameList;

    /**
     * 生成类型
     */
    private GeneratorType generatorType;

    /**
     * 包名
     */
    private String packageName = "com.jackstraw";

    /**
     * 实体包名
     */
    private String packageEntity;

    /**
     * 持久层包名
     */
    private String packageDao;

    /**
     * 服务层包名
     */
    private String packageService;

    /**
     * 表名前缀
     */
    private String tablePrefix = "t_";

    /**
     * 文件作者
     */
    private String author = "jack";

    private String email = "945514650@qq.com";

    private String version = "1.0";


    /**
     * 生成在main目录下还是test目录下
     */
    private String mainOrTest = "main";

    /**
     * 数据库类型枚举
     */
    private DataBaseEnum dataBaseEnum;


    public String getPackageEntity() {
        if (StringUtil.StringUtilsBylang3.isEmpty(this.packageEntity)) {
            return this.packageName;
        }
        return packageEntity;
    }

    public String getPackageDao() {
        if (StringUtil.StringUtilsBylang3.isEmpty(this.packageDao)) {
            return this.packageName;
        }
        return packageDao;
    }

    public String getPackageService() {
        if (StringUtil.StringUtilsBylang3.isEmpty(this.packageService)) {
            return this.packageName;
        }
        return packageService;
    }
}
